import api from "./request";

// 检查是否收藏
export const checkFavoriteStatus = (postId: number, userId: number) => {
  return api.post("/collections/iscollect", null, {
    params: { postId, userId },
  });
};

// 收藏帖子
export const favoritePost = (postId: number, userId: number) => {
  return api.post("/collections/collect", null, {
    params: { postId, userId },
  });
};

// 取消收藏
export const unfavoritePost = (postId: number, userId: number) => {
  return api.delete("/collections/uncollect", {
    params: { postId, userId },
  });
};

// 获取用户收藏列表
export const getUserFavorites = (
  userId: number,
  params?: {
    PageNum?: number;
    PageSize?: number;
    categoryId?: number | null;
  }
) => {
  return api.get("/collections/get", {
    params: { userId, ...params },
  });
};
